﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html; charset=UTF-8" language="java" pageEncoding="UTF-8"%>
<%@include file="/common/taglibs.jsp" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>ITO职业能力实训工程室平台</title>
    <link  href="${ctx}/static/css/index.css" rel="stylesheet" type="text/css" /> 
    <link  href="${ctx}/static/ligerui/lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" /> 
   
    <script src="${ctx}/static/jquery/jquery-1.8.3.min.js" type="text/javascript"></script>    
    <script src="${ctx}/static/ligerui/lib/ligerUI/js/ligerui.all.js" type="text/javascript"></script> 
    
    <link href="${ctx}/static/ligerui/lib/css/common.css" rel="stylesheet" type="text/css" />  
    <link href="${ctx}/static/ligerui/lib/css/index.css" rel="stylesheet" type="text/css" />
    
    <link href="${ctx}/static/css/student/student.css" rel="stylesheet" type="text/css" />
    
    <script src="${ctx}/static/ligerui/lib/js/LG.js" type="text/javascript"></script>
    <script src="${ctx}/static/ligerui/lib/js/login.js" type="text/javascript"></script>
    <script src="${ctx}/static/js/main.js" type="text/javascript"></script>
    <script src="${ctx}/static/js/common.js" type="text/javascript"></script>
    <script src="${ctx}/static/js/student/cloud-carousel.1.0.5.min.js" type="text/javascript"></script>
    <script src="${ctx}/static/js/student/jquery.mousewheel.js" type="text/javascript"></script>
    <script src="${ctx}/static/js/student/student-home.js" type="text/javascript"></script>
    <script src="${ctx}/static/js/student/student.js" type="text/javascript"></script>    
    
    <script src="${ctx}/static/js/comet/comet.js" type="text/javascript"></script>
    
    <script type="text/javascript">
	//window.name必须系统内唯一
	window.name="studentHome";
	//	听课内容窗口 
	var listenDialog=null;
	//	实训项目窗口
	var trainDialog=null;
	//  个人讯息窗口
	var stuInfoDialog=null;
    //  教师讯息窗口
    var teaInfoDialog=null;
    // 	求教帮助窗口
    var questionDialog=null;
    //	学生端问题指导窗口，不管是学生主动加入还是被动加入，都用此对象。
    //	不允许主动窗口和被动窗口同时打开。 
    var stuInstructDialog=null;
    
    var dialog;

		function closeDialog(){
			dialog.close();
		}
		/*
		*关闭听课窗口
		*/
		function closeListenDialog(){
			if(listenDialog!=null){
				listenDialog.close();
			}
		}
		/*
		*传入指定的dialog编号，关闭dialog
		*1-听课内容
		*2-实训项目
		*3-个人信息
		*4-教师信息
		*5-求教帮助
		*6-学生指导三分屏
		*/
		function closeTheDialog(typeNum){
			switch(typeNum){
			case 1:
				if(listenDialog!=null){
					listenDialog.close();
				}
				break;
			case 2:
				if(trainDialog!=null){
					trainDialog.close();
				}
				break;
			case 3:
				if(stuInfoDialog!=null){
					stuInfoDialog.close();
				}
				break;
			case 4:
				if(teaInfoDialog!=null){
					teaInfoDialog.close();
				}
				break;
			case 5:
				if(questionDialog!=null){
					questionDialog.close();
				}
				break;
			case 6:
				if(stuInstructDialog!=null){
					stuInstructDialog.close();
				}
				break;
			}
		}

		function toQuestion(){
			var geo=getWinGeometry(window);
			if(questionDialog!=null){
				questionDialog.close();
			}else{
			}
			questionDialog=$.ligerDialog.open({url: '${ctx}/qso/helpque/toQuestion',name:"studentAsk",height:geo.height-40,width:geo.width-400,showMax:true,showToggle:true,showMin:true,isResize:false,modal:true,isDrag:false,allowClose:true,isHidden:false,title:"求教"});

		}
		
		function toListen(vmId){
			vmId= vmId || "";
			var geo=getWinGeometry(window);
			if(listenDialog!=null){
				listenDialog.close();
			}else{
			}
			//dialog=$.ligerDialog.open({url: '${ctx}/qso/lesson/listen?vmId='+vmId,name:"toListen",height:geo.height-40,width:geo.width-400,showMax:true,showToggle:true,showMin:true,isResize:true,modal:true,allowClose:true,isHidden:false,title:"听课"});
			listenDialog=window.open("${ctx}/qso/lesson/listen?vmId="+vmId,"toListen","height="+geo.height-40+",width="+geo.width-400+",left=200,top=50,scrollbars=yes,resizable=yes");
		}
		
		function toMyCourse() {
			$(".l-tab-links").show();
			//f_addTab("tabcourse","我的课程", "${ctx}/course/toList");
			f_addTab("tabbtable","我的课表", "${ctx}/qso/mybtable/toList");
			//tab.selectTabItem('tabcourse');
		}
		
		/**
		*我的课程中打开四个tab页签
		*/
		function openMyCourseTab(){
			$(".l-tab-links").show();
			//f_addTab("tabCourse","我的课程", "${ctx}/qso/myRegisterCourse/toList");
			f_addTab("tabbtable","我的课表", "${ctx}/qso/mybtable/toList");
			//f_addTab("tabCourseRegist","课程注册", "${ctx}/qso/courseRegister/toList");
			//f_addTab("tabHomeworkSubmit","作业缴交", "${ctx}/qso/homeworkSubmit/toList");
		}
		/**
		*我的资源中打开两个个tab页签
		*/
		function openMyResourceTab(){
			$(".l-tab-links").show();
			f_addTab("tabResourse","资源管理", "${ctx}/qso/stuaid/toList");
			f_addTab("tabBookShelf","我的书架", "${ctx}/qso/stuaidcase/toList");
		}
		//看老师桌面
		function lookTeaDesktop(){
			LG.ajax({
				url:"${ctx}/qso/lesson/checkTeaDesktop",
				success:function(result){
					if(result.success){
						if(result.data){
							toListen();
						}else{
							$.ligerDialog.warn("不能连接老师桌面，请检查是否<BR>在上课时间内并且老师已经开始<BR>上课!");
						}
					}
				}
			});
		}
		
		function toTrain(){
			if(trainDialog!=null){
				trainDialog.close();
			}else{
			}
			//trainDialog=$.ligerDialog.open({url: '${ctx}/qso/lesson/train',name:"toTrain",height:650, width:800, showMax: true, showToggle: true, showMin: false, isResize: true, modal: true,allowClose:true,isHidden:false, title:"实训"});
			trainDialog=window.open("${ctx}/qso/lesson/train","toTrain","height=650, width=800,left=200,top=50,scrollbars=yes,resizable=yes");

		}
		
		function studentMessage(){
			if(stuInfoDialog!=null){
				stuInfoDialog.close();
			}else{
			}
			stuInfoDialog=$.ligerDialog.open({url: '${ctx}/qso/student/message',name:"stuMessage",height:250, width:450, showMax: true, showToggle: true, showMin: true, isResize: true, modal: true,allowClose:true,isHidden:false, title:"个人讯息"});
		}
		
		function teacherMessage(){
			if(teaInfoDialog!=null){
				teaInfoDialog.close();
			}else{
			}
			teaInfoDialog=$.ligerDialog.open({url: '${ctx}/qso/teacher/message',name:"teaMessage",height:250, width:450, showMax: true, showToggle: true, showMin: true, isResize: true, modal: true,allowClose:true,isHidden:false, title:"教师讯息"});
		}
		
		function studentReceive(result){
			/*
            $.ligerDialog.confirm("老师开始指导,请加入讨论组!", function (flag){
            	if(flag){
            		joinGroup(result.data);
            	}else{
            		alert("稍后加入! 要特殊处理比如在页面显示个按钮，当用户店家的时候再加入!");
            	}
         	});
            */
           if(window.confirm("老师开始指导,请加入讨论组!")){
        	   joinGroup(result.data);
           }
		}
		
	    function saveAsync(){
	    	$("#cometFrame").attr("src","${ctx }/qso/comet/saveAsync?r="+Math.random());
	    }
	    
	    function joinGroup(groupId){
	    	closeTheDialog(6);
	    	var geo=getWinGeometry(window);
	    	stuInstructDialog=$.ligerDialog.open({url: '${ctx}/qso/instruct/joinGroup/'+groupId,name:"instruct",height:geo.height-40,width:geo.width, showMax: true, showToggle: true, showMin: true, isResize: true, modal: true,isDrag:false,allowClose:true,isHidden:false,title:"指导"});
	    }
	    
	    
	    function initiativeJoin(groupId){
	    	closeTheDialog(6);
	    	var geo=getWinGeometry(window);
	    	stuInstructDialog=$.ligerDialog.open({url: '${ctx}/qso/instruct/initiativeJoin/'+groupId,name:"instruct",height:geo.height-40,width:geo.width, showMax: true, showToggle: true, showMin: true, isResize: true, modal: true,isDrag:false,allowClose:true,isHidden:false,title:"指导"});
	    }
	    
	    //老师完成讨论时,学生关闭聊天窗口
	    function closeGroupDialog(){
	    	var askMainWin=window.frames["studentAsk"];
	    	if(askMainWin){
	    		askMainWin.loadCurrentQuestion();
	    	}
	    	stuInstructDialog.close();
	    }
	    
	    function onClose(){
	    	var ua = navigator.userAgent.toLowerCase();
	        if (window.ActiveXObject)
	    		var ie = ua.match(/msie ([\d.]+)/)[1];
	    	else if (document.getBoxObjectFor)
	    	    var firefox = ua.match(/firefox\/([\d.]+)/)[1];
	    	if(ie) {//for IE
	    		if(event.clientX>document.body.clientWidth&&event.clientY<0||event.altKey){      
	    			window.location.href ="${ctx}/logout";    
	    		}   
	    	}
	    }
	    
		addLoadEvent(saveAsync);
	</script>
</head>
<body style="text-align:center;overflow:hidden;" onbeforeunload="onClose();">
	<center>
	<div class="main-wrapper rel" style="width: 1000px; height: 640px;">
    <div id="pageloading" style="display:block;"></div> 
    <div id="topmenu" class="l-topmenu">
        <div class="l-topmenu-logo"><img src="${ctx}/static/css/student/img/student-logo.png" /></div>
        <div class="l-topmenu-welcome"> 
            <span class="l-topmenu-username"></span>欢迎您, <shiro:principal/> !&nbsp;
            <a href="${ctx }/logout" style="background:url('${ctx}/static/icons/main/logout.png') no-repeat scroll transparent;padding-left:24px;">退出</a>
        </div> 
        
    </div> 
     <div id="mainbody" class="l-mainbody" style="width:995px; margin:0 auto; margin-top:3px;" >
        <div position="center" id="framecenter" style="height:100%;width:99%;">
            <div tabid="home" title="我的主页">
                <iframe frameborder="0" name="home" id="home" src="${ctx }/welcomeStudent"></iframe>
            </div>
        </div> 
    </div>
   <div id="vertical-nav-wrap" class="vertical-nav-wrap abs fix">
        <div class="vertical-nav-hd l">
        </div>
        <div class="vertical-nav-bd r">
          <a href="javascript:lookTeaDesktop();" url="/${ctx}/dept/toList" class="teaching-contents">
           	<span>听课内容</span>
          </a>
          <a href="javascript:toTrain();" class="exercise-items">
           	 实训项目
          </a>
          <a href="javascript:studentMessage();" class="profile">
           	 个人讯息
          </a>
          <a href="javascript:teacherMessage();" class="teacher-profile">
           	 教师讯息
          </a>
          <a href="javascript:toQuestion();" class="help">
           	求教帮助
          </a>
        </div>
    </div>
    <div class="vertical-nav-hidden"></div>
    <div id="footermenu" class="footermenu">
	  <div class="horizontal-nav abs">
        <div class="home" style="float:left;"><a url="/${ctx}/welcomeStudent" style="padding-top:15px; color:#a4c5e6;" id="myhome"><span>首页</span></a></div>
		<div class="course" style="float:left;"><a href="javascript:openMyCourseTab();"  style="padding-top:15px; color:#a4c5e6; cursor:pointer;text-decoration:none;" id="mycourse"><span>我的课程</span></a></div>
       
 <!--        
  <div class="btable" style="float:left;"><a href="javascript:openMyResourceTab();" style="padding-top:15px; color:#a4c5e6; cursor:pointer;text-decoration:none;" id="mybtable"><span>我的资源</span></a></div>
 
			url="qso/stuaid/toList"
			url="qso/mybtable/toList"
			url="qso/courseRegister/toList" 
 
        <div class="courseRegist"><a href="javascript:testMyRegist();"  style="padding-top:15px; color:#a4c5e6; cursor:pointer;" id="myCourseRegist"><span>课程注册</span></a></div>
        <div class="homeworkSubmit"><a url="qso/homeworkSubmit/toList" style="padding-top:15px; color:#a4c5e6; cursor:pointer;" id="myHomeworkSubmit"><span>作业缴交</span></a></div>
 -->       
        <div class="myinfo last"><a url="qso/student/info" style="padding-top:15px; color:#a4c5e6;" id="myinfo"><span>个人资料</span></a></div>
      </div>
      <div class="footer">
      	版权所有 启秀科技（北京）有限公司
      </div>	
    </div>    
    <div class="l-hidden"></div>
    </div>
    </center>
    <script type="text/javascript">
        //tabid计数器，保证tabid不会重复
        var tabidcounter = 0;
   
        //增加tab项的函数
        function f_addTab(tabid, text, url) {
            if (!tab) return;
            if (!tabid)
            {
                tabidcounter++;
                tabid = "tabid" + tabidcounter; 
            }
            tab.addTabItem({ tabid: tabid, text: text, url: url });
        }
        //修改密码
        function f_changepassword()
        {
            LG.changepassword();
        }
        $(document).ready(function ()
        {

            //菜单初始化
            $("div.horizontal-nav a").live('click', function ()
            {
            	$(".l-tab-links").show();
            	
                var jitem = $(this);
                var tabid = jitem.attr("tabid");
                var url = jitem.attr("url");
                if (!url) return;
                if (!tabid)
                {
                    tabidcounter++;
                    tabid = "tabid" + tabidcounter;
                    jitem.attr("tabid", tabid);
                    jitem.attr("url", url);
                }
                f_addTab(tabid, $("span:first", jitem).html(), url);
            }).live('mouseover', function ()
            {
                var jitem = $(this);
                jitem.addClass("over");
            }).live('mouseout', function ()
            {
                var jitem = $(this);
                jitem.removeClass("over");
            });

            //布局初始化 
            //layout
            layout = $("#mainbody").ligerLayout({ height: '438px'});
            var bodyHeight = $(".l-layout-center:first").height();
            //Tab
            tab = $("#framecenter").ligerTab({ height: bodyHeight, contextmenu: true });


            //预加载dialog的背景图片
            LG.prevDialogImage("${ctx}");
			
            $(".l-tab-links").hide();
            $("#pageloading").hide();
            
            $("#framecenter").ligerTab(
 				{
 					onAfterRemoveTabItem:function(tabid){ 
 						var count = tab.getTabItemCount();
 		            	if (count == 0)
 		            	{
 		            		f_addTab('home','','welcomeStudent');
 		            		$(".l-tab-links").hide();
 		            	}
 					},
 					onAfterAddTabItem:function(tabid){
 						if(tabid != 'home')
 							tab.removeTabItem('home');
 					},
 					onAfterSelectTabItem:function(tabid)
 					{
//  						if(tabid == 'tabbtable')
//  							{
//  							tab.reload('tabbtable');
//  							}
						tab.reload(tabid);
 					}
 				});
            
            $(".home").live('click', function ()
            {
            	tab.removeAll('home');
            });

/**
 *             LG.ajax({
     type: 'AjaxMemberManage',
     method: 'GetCurrentUser',
     success: function (user)
     {
         $(".l-topmenu-username").html(user.Title + "，");
     },
     error: function ()
     {
         LG.tip('用户信息加载失败');
     }
 });
 */
        });
        

    </script>
<iframe id="cometFrame" style="display: none;"></iframe>
</body>
</html>